<template>
  <div class="NotBox">
    <!-- 被关注页面 -->
    <div class="NotBoxtitle">
      <span>消息中心</span>
      <div class="notBoxFun">
        <p
          :class="isInfoActive == true ? infoActive : ''"
          @click="isInfoActiveFlipT"
        >
          通知
        </p>
        <p
          :class="isInfoActive == false ? infoActive : ''"
          @click="isInfoActiveFlipF"
        >
          私信
        </p>
      </div>
    </div>
    <!-- 通知界面 -->
    <div v-show="isInfoActive == true">
      <ul class="NotCount">
        <li class="notList" v-for="(item, index) in notList" :key="index">
          <p class="notListDate">{{ item.date }}</p>
          <p class="notImgBox">
            <img :src="item.img" alt="" />
          </p>
          <p class="notListText">
            <span>{{ item.title }}</span
            >关注了<span>您</span>
          </p>
        </li>
      </ul>
    </div>
    <!-- 私信界面 -->
    <div v-show="isInfoActive == false">
      <ul>
        <li class="private" v-for="(item, index) in notList" :key="index">
          <div class="privateImgBox">
            <img :src="item.img" alt="" />
          </div>
          <div class="privateCount">
            <p>
              来自<span class="privateTitle">{{ item.title }}</span
              >的私信
              <span class="privateDate">2016-06-23</span>
            </p>
            <p>恭喜您获得优惠券一张,快去领取吧!</p>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import api from "../../api";
export default {
  data() {
    return {
      notList: [],
      isInfoActive: true,
      infoActive: "infoActive",
    };
  },
  mounted() {
    api.getFollow().then((res) => {
      //console.log(res.data.followList);
      this.notList = res.data.followList;
    });
  },
  methods: {
    isInfoActiveFlipF() {
      this.isInfoActive = false;
    },
    isInfoActiveFlipT() {
      this.isInfoActive = true;
    },
  },
};
</script>

<style>
.NotBox {
  width: 900px;
  height: 780px;
  background: #fff;
}
.NotBoxtitle {
  height: 50px;
  width: 100%;
  line-height: 50px;
  color: #999;
  text-align: left;
  border-bottom: 1px solid #ccc;
}
.NotBoxtitle > span:first-child {
  margin-left: 50px;
}
.NotCount {
  width: 880px;
  padding: 10px;
}
.notList {
  width: 100%;
  height: 105px;
  text-align: left;
}
.notList > .notListDate {
  width: 860px;
  height: 35px;
  line-height: 35px;
  background: #ebebeb;
  padding-left: 20px;
}
.notImgBox {
  width: 40px;
  height: 40px;
  margin-left: 10px;
  margin-top: 10px;
  float: left;
}
.notImgBox > img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.notListText {
  height: 40px;
  line-height: 40px;
  margin-left: 10px;
  margin-top: 10px;
  float: left;
}
.notListText > span:first-child {
  color: #09ade2;
  margin-right: 10px;
}
.notListText > span:last-child {
  margin-left: 10px;
}
.infoActive {
  border-bottom: 2px solid #09ade2;
}
.notBoxFun {
  width: 120px;
  float: right;
  display: flex;
  justify-content: center;
}
.notBoxFun > p {
  width: 60px;
  height: 48px;
  text-align: center;
  color: #000;
}
.private {
  padding: 15px;
  height: 75px;
  text-align: left;
  width: 840px;
  margin: 0 15px;
  border-bottom: 1px solid #ccc;
}
.privateImgBox {
  width: 75px;
  height: 75px;
  float: left;
  margin-right: 15px;
}
.privateImgBox > img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.privateCount {
  height: 60px;
  float: left;
  width: 750px;
  margin-top: 5px;
  line-height: 30px;
}
.privateTitle {
  margin: 0 10px;
  color: #09ade2;
}
.privateDate {
  display: inline-block;
  float: right;
  color: #ccc;
  font-size: 14px;
}
</style>